import requests

# response = requests.get("http://www.baidu.com/")

kw = {"wd":"中国"}
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"}

response = requests.get("http://www.baidu.com/s", params=kw, headers=headers)
# print(response.text)  经过了解码之后的数据

# print(response.content.decode("utf-8"))

with open('baidu.html', 'w', encoding='utf-8') as fp:
    fp.write(response.content.decode('utf-8'))

